import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

/**
 * @Author Stringzhua
 * @Date 2024/10/31 14:25
 * description:
 */
public class Demo02 {
    public static void main(String[] args) throws InterruptedException {
        ArrayBlockingQueue<String> blockingQueue = new ArrayBlockingQueue<String>(5);
//        LinkedBlockingQueue<String> blockingQueue = new LinkedBlockingQueue<>(5);

        //入队add()、offer()、put()、
        blockingQueue.add("1");
        blockingQueue.offer("1");

        blockingQueue.put("1");
        blockingQueue.put("2");
        blockingQueue.put("3");
        blockingQueue.put("4");
        blockingQueue.put("5");
        blockingQueue.put("6");

        //出队
        blockingQueue.poll();
        blockingQueue.take();

        System.out.println(blockingQueue);
    }
}
